// index.js
Page({
  data: {
    list: [
      {
        title: '视图容器',
        id: 'view',
        childList: ['view', 'scroll-view', 'swiper'],
        open: false,
      },
      {
        title: '基础内容',
        id: 'content',
        childList: ['text', 'icon', 'progress'],
        open: false,
      },
      {
        title: '表单组件',
        id: 'form',
        childList: ['botton', 'checkbox', 'form'],
        open: false,
      },
      {
        title: '导航',
        id: 'map',
        childList: ['navigator'],
        open: false,
      },
    ]
  },
  childPageToggle: function (e) {
    //console.log(e.currentTarget.id);
    let [id, list] = [e.currentTarget.id, this.data.list];
    for (let i = 0; i < list.length; i++) {
      if (list[i].id === id) {
        list[i].open = !list[i].open;
      } else {
        list[i].open = false;
      }
    }
    this.setData({
      list: list
    })
  }
})